// Learn TypeScript:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html

const { ccclass, property } = cc._decorator;

@ccclass
export default class GiftItem extends cc.Component {

    @property(cc.Label)
    countTxt: cc.Label = null;
    @property(cc.Sprite)
    icon: cc.Sprite = null;

    drawItem(count: string, resName: string) {
        this.countTxt.string = "x" + count;
        cc.resources.load("UIRes/GiftRes/" + resName, cc.SpriteFrame, (e, asset) => {
            this.icon.spriteFrame = asset;
        });
    }
}
